#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]){
	if(argc<3){
		perror("Few parameters:");
		exit(1);
	}
	FILE* read_png=fopen(argv[1],"r");
	FILE* write_png=fopen(argv[2],"w");
	if(NULL==read_png||NULL == write_png){
		perror("fopen fail:");
		exit(1);
	}
	char buff[128];
	size_t read_size=0;
	while((read_size=fread(buff,sizeof(char),sizeof(buff),read_png))){
		if(fwrite(buff,sizeof(char),read_size,write_png)<0){
			perror("fwrite fail:");
			exit(1);
		}
	}
	rewind(read_png);
	FILE* write_png_cpy=fopen("photo_cpy.png","w");
    if(NULL == write_png_cpy){
         perror("fopen fail:");
         exit(1);
    }
	while((read_size=fread(buff,sizeof(char),sizeof(buff),read_png))){
		if(fwrite(buff,sizeof(char),read_size,write_png_cpy)<0){
			perror("fwrite fail:");
			exit(1);
		}	
	}
	fclose(read_png);
	fclose(write_png);
	return 0;
}
